import { ICON_TYPE } from '@/const'

const commonProps = {
  disabled: {
    type: Boolean,
    default: false,
  },
  autoUpload: {
    type: Boolean,
    default: false,
  },
  action: {
    type: String,
    default: '',
  },
  name: {
    type: String,
    default: 'name',
  },
  data: {
    type: [Object, Function],
    default: () => {},
  },
  showFileList: {
    type: Boolean,
    default: true,
  },
  limit: {
    type: Number,
    default: 3,
  },
  multiple: {
    type: Boolean,
    default: true,
  },
  borderRadius: {
    type: String,
    default: '4px',
  },
  title: {
    type: String,
    default: '',
  },
  iconName: {
    type: String,
    default: 'Plus',
  },
  iconType: {
    type: String,
    default: ICON_TYPE.EL_ICON,
    validator: (value) => [ICON_TYPE.EL_ICON, ICON_TYPE.SVG].includes(value),
  },
  iconSize: {
    type: [Number, String],
    default: 18,
  },
  height: {
    type: String,
    default: '148px',
  },
  width: {
    type: String,
    default: '148px',
  },
  customStyle: {
    type: Object,
    default: () => {},
  },
}

export const uploadImgProps = {
  ...commonProps,
  tip: {
    type: String,
    default: '',
  },
  // 最大文件大小 默认10MB
  maxSize: {
    type: Number,
    default: 10,
  },
  round: {
    type: Boolean,
    default: false,
  },
  drag: {
    type: Boolean,
    default: false,
  },
  // 自定义上传函数
  api: Function,
  previewText: {
    type: String,
    default: '查看',
  },
  previewIcon: {
    type: String,
    default: 'View',
  },
  deleteText: {
    type: String,
    default: '删除',
  },
  deleteIcon: {
    type: String,
    default: 'Delete',
  },
}

export const uploadFileProps = {
  ...commonProps,
  tag: {
    type: String,
    default: 'button',
    validator: (value) => ['button', 'card'].includes(value),
  },
  accept: {
    type: String,
    default: '',
  },
}
